package listdemo;

public class Test {

    public static void main(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.addLast(2);
        mySingleList.display();

        mySingleList.removeElements(2);
        mySingleList.display();
    }

    public static void main3(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addFirst(2);
        mySingleList.addFirst(2);
        mySingleList.addFirst(2);
        mySingleList.addFirst(2);
        mySingleList.addFirst(2);
        mySingleList.display();
        System.out.println("===================");
        mySingleList.removeAllKey(2);
        mySingleList.display();
    }

    public static void main2(String[] args) {
        MySingleList mySingleList = new MySingleList();
//        mySingleList.addFirst(1);
//        mySingleList.addFirst(2);
//        mySingleList.addFirst(3);
//        mySingleList.addFirst(4);
//        mySingleList.addFirst(5);
//        mySingleList.display();

        mySingleList.addLast(88);
        mySingleList.addLast(89);
        mySingleList.addLast(90);
        mySingleList.display();
        mySingleList.addIndex(0,7);
        mySingleList.display();
        mySingleList.addIndex(2,8);
        mySingleList.display();

        mySingleList.remove(90);
        mySingleList.display();

    }

    public static void main1(String[] args) {

        MySingleList mySingleList = new MySingleList();
        mySingleList.creatList();
        System.out.println("=====================");
        mySingleList.display();
        System.out.println("=====================");

        boolean ret = mySingleList.contains(5);
        if (ret) {
            System.out.println("存在这个节点");
        } else {
            System.out.println("不存在这个节点");
        }

        System.out.println("=====================");

        int len = mySingleList.size();
        System.out.println(len);

        mySingleList.addFirst(99);
        mySingleList.display();
    }

}
